<?php
use common\service\StaticService;
use backend\assets\AdminAsset;
use common\service\GlobalUrlService;

StaticService::includeAppJsStatic(GlobalUrlService::buildStaticUrl('/backend/permission/update-group.js'),AdminAsset::class);
$classes = [
  1=>'listO',
  2=>'listT',
  3=>'listTh',
];
$first_classes = [
  1=>'contbox contbox1',
  2=>'contbox contbox2',
  3=>'contbox contbox3',
];
?>

<div class="layui-card">
    <div class="layui-card-header">修改权限组</div>
    <div class="layui-card-body">
        <div class="layui-form-item">
            <label class="layui-form-label">权限组名称</label>
            <div class="layui-inline">
                <input type="text" class="layui-input group_name" name="group_name" value="<?= $data['group_name']?>">
            </div>
        </div>
        <div class="layui-form-item layui-form">
            <label class="layui-form-label">权限</label>
            <div class="layui-inline">
                <?php foreach ($perms as $row):?>
                    <div class="<?php echo isset($first_classes[$row['level']]) ? $first_classes[$row['level']] : ''?>">
                        <input lay-filter="check" type="checkbox" <?php if($row['checked'] == 'true'){echo 'checked';}?> title="<?=$row['menu_name']?>" id="list<?=$row['menu_id']?>" value="<?=$row['menu_id']?>" <?php if($row['menu_id']==1 ){echo 'checked disabled';}?> class="<?php echo isset($classes[$row['level']]) ? $classes[$row['level']] : ''?>" lay-skin="primary">
                    </div>
                <?php endforeach;?>
            </div>
        </div>
        <input type="hidden" name="group_id" class="hide-id" value="<?= $data['group_id']?>"/>
        <div class="layui-form-item">
            <button type="button" class="layui-btn btn-save">保存</button>
            <button type="button" class="layui-btn layui-btn-primary" onclick="window.history.go(-1);">取消</button>
        </div>
    </div>
</div>
<style>
    li{list-style: none;}
.power{
    border: 1px solid #bbb;
    margin-left: 180px;
}
.content-box{
    width: 250px;
    margin: 10px 0 10px 10px;
    border: 1px solid #ddd;
}
.contbox{
    padding-left: 30px;
}
.contbox2{
    padding-left: 60px;
}
.contbox3{
    padding-left: 90px;
}
.listO,.listT,.listTh{
    opacity: 1!important;
    margin: 0;
}
</style>